package github.liweiwei.utils;

/**
 * @Author: DRevelation
 * @Date: 2021/9/16 15:32
 */
public class SortUtil {
    
    public static void swap(int[] arr, int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    /**
     * 必须保证i不等于j
     * @param arr
     * @param i
     * @param j
     */
    public static void swap2(int[] arr, int i, int j) {
        arr[i] = arr[i] ^ arr[j];
        arr[j] = arr[i] ^ arr[j];
        arr[i] = arr[i] ^ arr[j];
    }
}
